package com.base.web.core.util;

import javax.servlet.http.HttpServletRequest;
import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * Description: 请求处理工具类
 * User: Mario
 * Date: 2018-06-18 14:47
 */
public class RequestUtil {
    /**
     * 判断是否是Ajax请求
     *
     * @param request
     * @return
     */
    public static boolean isAjax(HttpServletRequest request) {
        String requestType = request.getHeader("X-Requested-With");
        if (Objects.equals("XMLHttpRequest", requestType)) {
            return true;
        } else {
            return false;
        }
    }
}
